//
//  ViewController.m
//  酷狗游戏中心
//
//  Created by 卢泽添 on 15/7/15.
//  Copyright (c) 2015年 卢泽添. All rights reserved.
//

#import "ViewController.h"
#import "UserCenterViewController.h"
#import "GameCenterViewController.h"
#import "CircleViewController.h"
#import "MainTabBarViewController.h"
#import "UserCenterViewController.h"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (IBAction)textGotoGameCenter:(id)sender {
    [self setIntegrationViewController];
}


-(id)getViewControllerWithCurrentStoryboard:(UIStoryboard *)storyboard andIdentifier:(NSString *)identifier
{
    return [storyboard instantiateViewControllerWithIdentifier:identifier];
}

-(id)getUIStoryboard:(NSString *)name
{
    return [UIStoryboard storyboardWithName:name bundle:nil];
}

-(void)setIntegrationViewController
{
    UIStoryboard *gameCenter_SB =[self getUIStoryboard:@"KGGameCenter"];
    GameCenterViewController *gameCenter_VC =[self getViewControllerWithCurrentStoryboard:gameCenter_SB andIdentifier:@"gameCenter"];
    gameCenter_VC.title = @"玩";
    UIStoryboard *circle_SB = [self getUIStoryboard:@"CircleCenter"];
    CircleViewController *circle_VC = [self getViewControllerWithCurrentStoryboard:circle_SB andIdentifier:@"circle"];
    circle_VC.title = @"圈子";
    UIStoryboard *main_SB = [self getUIStoryboard:@"MainTabBar"];
    MainTabBarViewController *main_VC =[self getViewControllerWithCurrentStoryboard:main_SB andIdentifier:@"mainTabBar"];
    
    UIStoryboard *userCenter_SB = [self getUIStoryboard:@"UserCenter"];
    MainTabBarViewController *userCenter_VC =[self getViewControllerWithCurrentStoryboard:userCenter_SB andIdentifier:@"userCenter"];
    userCenter_VC.title = @"我";
    main_VC.viewControllers = @[gameCenter_VC,circle_VC,userCenter_VC];
    [self.navigationController pushViewController:main_VC animated:YES];
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
